home *** CD-ROM | disk | FTP | other *** search
- Public Class MDIForm
- Inherits System.Windows.Forms.Form
-
- #Region " Windows Form Designer generated code "
-
- Public Sub New()
- MyBase.New()
-
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
-
- 'Add any initialization after the InitializeComponent() call
-
- End Sub
-
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
- Friend WithEvents Button1 As System.Windows.Forms.Button
- Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
- Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
- Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
- Friend WithEvents mnuNewWindow As System.Windows.Forms.MenuItem
- Friend WithEvents mnuWindowCloseAll As System.Windows.Forms.MenuItem
- Friend WithEvents mnuWindowArrange As System.Windows.Forms.MenuItem
- Friend WithEvents mnuWindowTileVer As System.Windows.Forms.MenuItem
- Friend WithEvents mnuWindowTileHor As System.Windows.Forms.MenuItem
- Friend WithEvents mnuWindowCascade As System.Windows.Forms.MenuItem
-
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.Container
-
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.mnuWindowTileVer = New System.Windows.Forms.MenuItem()
- Me.mnuWindowCascade = New System.Windows.Forms.MenuItem()
- Me.mnuWindowTileHor = New System.Windows.Forms.MenuItem()
- Me.MainMenu1 = New System.Windows.Forms.MainMenu()
- Me.MenuItem4 = New System.Windows.Forms.MenuItem()
- Me.mnuNewWindow = New System.Windows.Forms.MenuItem()
- Me.MenuItem1 = New System.Windows.Forms.MenuItem()
- Me.mnuWindowArrange = New System.Windows.Forms.MenuItem()
- Me.mnuWindowCloseAll = New System.Windows.Forms.MenuItem()
- Me.Button1 = New System.Windows.Forms.Button()
- Me.SuspendLayout()
- '
- 'mnuWindowTileVer
- '
- Me.mnuWindowTileVer.Index = 2
- Me.mnuWindowTileVer.Text = "Tile &Vertically"
- '
- 'mnuWindowCascade
- '
- Me.mnuWindowCascade.Index = 0
- Me.mnuWindowCascade.Text = "&Cascade"
- '
- 'mnuWindowTileHor
- '
- Me.mnuWindowTileHor.Index = 1
- Me.mnuWindowTileHor.Text = "Tile &Horizontally"
- '
- 'MainMenu1
- '
- Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem4, Me.MenuItem1})
- '
- 'MenuItem4
- '
- Me.MenuItem4.Index = 0
- Me.MenuItem4.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuNewWindow})
- Me.MenuItem4.MergeType = System.Windows.Forms.MenuMerge.MergeItems
- Me.MenuItem4.Text = "&File"
- '
- 'mnuNewWindow
- '
- Me.mnuNewWindow.Index = 0
- Me.mnuNewWindow.Text = "&New Window"
- '
- 'MenuItem1
- '
- Me.MenuItem1.Index = 1
- Me.MenuItem1.MdiList = True
- Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuWindowCascade, Me.mnuWindowTileHor, Me.mnuWindowTileVer, Me.mnuWindowArrange, Me.mnuWindowCloseAll})
- Me.MenuItem1.MergeOrder = 3
- Me.MenuItem1.Text = "&Window"
- '
- 'mnuWindowArrange
- '
- Me.mnuWindowArrange.Index = 3
- Me.mnuWindowArrange.Text = "&Arrange icons"
- '
- 'mnuWindowCloseAll
- '
- Me.mnuWindowCloseAll.Index = 4
- Me.mnuWindowCloseAll.Text = "C&lose All"
- '
- 'Button1
- '
- Me.Button1.Location = New System.Drawing.Point(40, 48)
- Me.Button1.Name = "Button1"
- Me.Button1.Size = New System.Drawing.Size(208, 32)
- Me.Button1.TabIndex = 0
- Me.Button1.Text = "Make MDI form"
- '
- 'MDIForm
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
- Me.ClientSize = New System.Drawing.Size(552, 285)
- Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
- Me.Menu = Me.MainMenu1
- Me.Name = "MDIForm"
- Me.Text = "MDIForm"
- Me.ResumeLayout(False)
-
- End Sub
-
- #End Region
-
- ' make this form an MDI form when the button is clicked
-
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- ' make this form an MDI form
- Me.IsMdiContainer = True
- ' remove this button from the controls collection
- Me.Controls.Remove(Button1)
- End Sub
-
- ' create and display a child form
-
- Private Sub mnuNewWindow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuNewWindow.Click
- ' display the MenuForm as a child of this form
- Dim frm As New MenuForm()
- frm.MdiParent = Me
- frm.Show()
- End Sub
-
- ' Change the title of the MDI parent form to match the caption
- ' of the active child form.
-
- Private Sub MDIForm_MdiChildActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MdiChildActivate
- If Me.ActiveMdiChild Is Nothing Then
- Me.Text = "MDI Demo Program"
- Else
- Me.Text = Me.ActiveMdiChild.Text & " - MDI Demo Program"
- End If
- End Sub
-
- ' cascade, tile, and arrange all child forms
-
- Private Sub mnuWindowCascade_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuWindowCascade.Click
- Me.LayoutMdi(MdiLayout.Cascade)
- End Sub
-
- Private Sub mnuWindowTileHor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuWindowTileHor.Click
- Me.LayoutMdi(MdiLayout.TileHorizontal)
- End Sub
-
- Private Sub mnuWindowTileVer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuWindowTileVer.Click
- Me.LayoutMdi(MdiLayout.TileVertical)
- End Sub
-
- Private Sub mnuWindowArrange_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuWindowArrange.Click
- Me.LayoutMdi(MdiLayout.ArrangeIcons)
- End Sub
-
- ' close all child forms
-
- Private Sub mnuWindowCloseAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuWindowCloseAll.Click
- Dim frm As Form
- For Each frm In Me.MdiChildren
- frm.Close()
- Next
- End Sub
-
- End Class
-